package net.wesley.android.city;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import android.os.Handler;
import android.os.Message;
import android.util.Log;
import net.wesley.android.City;
import net.yebaihe.sdk.HttpConnection;

public class Suzhou extends City {

	private Handler request1handler=new Handler(){
		public void handleMessage(Message message){
			switch (message.what){
			case HttpConnection.DID_ERROR://DID ERROR
				callback.onComplete(-1, "");
				break;
			case HttpConnection.DID_SUCCEED://DID SUCC
				String body=(String)message.obj;
				Log.d("myown", body);
				break;
			}
		}
	};

	public void requestParamsFinish(String[] values) {
		try {
			String data=String.format("7|0|9|http://58.210.126.206:9091/QueryVD/queryvd/|5262F91C7EB710ACCA6AC7167DFEDE1F|com.cgs.client.GreetingService|queryVehicleResult|java.lang.String/2004016611| |02|%s|%s|1|2|3|4|4|5|5|5|5|6|7|8|9|",
					URLEncoder.encode(chepai,"UTF-8"),values[0]);
			new HttpConnection(ctx,request1handler,"UTF-8").post("http://58.210.126.206:9091/QueryVD/queryvd/greet", data);
			Log.d("myown", "post data:"+data);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}

	@Override
	public boolean match(String chepai) {
		return chepai.startsWith("苏E");
	}

	@Override
	public String[] paramDesc() {
		String[] s={"车辆识别代号"};
		return s;
	}

}
